POV-Ray : Newsgroups : povray.general : Explanation of recursive macros. : Re: Explanation of recursive macros. Server Time
8 Aug 2024 22:08:35 EDT (-0400)
  Re: Explanation of recursive macros.  
From: ryan constantine
Date: 13 Sep 2000 03:30:25
Message: <39BF2CE0.2ABA057B@yahoo.com>
BigCeef wrote:
> 
> Okay, I'm beginning to understand this. The line that says #local M=L-1; is
> actually a loop, yes? I've only used while() loops before, so I didn't get
> this at first.

actually, that isn't a loop, just a counter decrement.  a 'recursive'
function is a special kind of function.  it calls itself.  this makes
what might look like a family tree.  you start with the father, and he
has an identical son, which has an identical son, which has an identical
son... and each time a new generation is born, the decrement is made. 
in real life, sons usually out live fathers.  but in recursive
functions, the last one made is the first to die. when each son dies, he
gives the objects he created to his father.  then that son dies and
gives his object to his father and so on until the original father is
the only one left and he has all of the objects assembled which he gives
to povray.

> I'm finding it hard to get my head round Recurs(M) being INSIDE Recurs(L).
> 
> Also, your code generated the following warning, which I've been unable to
> remedy.
> 
> memory macro: 22: warning : Should have at least 2 objects in csg.
> Degenerate CSG bounding box (not used!)
> 
> Well, there are more than 2 objects in the union. Huh?

the warning is made because one or more sons have one or no object to
contribute to the whole.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.